<template>
  <view class="record-cell" @click.stop="handleSelect">
    <image
      mode="aspectFill"
      :src="info.cover"
      class="wardrobe-view-image"
    ></image>
    <!-- :class="{ video: info.type === 'video' }" -->
    <view class="info-view">
      <view class="title-view">{{ info.title }}</view>
      <view class="author-view">{{ info.subtitle }}</view>

      <view class="bottom-view">
        <text class="type-text">{{
          info.type === "video" ? "视频跟练" : "音频跟练"
        }}</text>
      </view>
    </view>
  </view>
</template>

<script setup>
import { reactive, ref } from "vue";
const props = defineProps({
  info: {
    type: Object,
    default() {
      return {};
    },
  },
});
const info = ref(props.info);

console.log(props.info);

const emit = defineEmits(["select", "operate"]);

const handleSelect = () => {
  emit("select", info.value); // 详情编辑
};

</script>

<style lang="scss" scoped>
.record-cell {
  background-color: #ffffff;
  // overflow: hidden;
  display: flex;
  padding: 32rpx 24rpx;
  border-radius: 16rpx;
  margin-bottom: 24rpx;
  box-shadow: 0rpx 4rpx 14rpx 0px rgba(0, 0, 0, 0.1);

  .wardrobe-view-image {
    width: 180rpx;
    height: 180rpx;
    background-color: #f6f7fb;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12rpx;
    flex-shrink: 0;
    margin-right: 32rpx;
  }
  .video {
    width: 320rpx;
    height: 180rpx;
  }

  .info-view {
    flex: 1;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    background-color: #ffffff;
    // height: 72rpx;

    .title-view {
      white-space: normal;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      -webkit-line-clamp: 2;
      font-size: 28rpx;
      font-weight: bold;
      height: 84rpx;
      flex-shrink: 0;
    }

    .author-view {
      font-size: 24rpx;
      color: #939999;
      line-height: 32rpx;
    }

    .bottom-view {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;

      .type-text {
        font-size: 24rpx;
        color: #939999;
        line-height: 32rpx;
      }

      .select-view {
        width: 80rpx;
        height: 56rpx;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        font-weight: bold;
        color: #595757;
        margin-right: -24rpx;
        padding-right: 24rpx;
      }
    }
  }
}
</style>
